home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 1 / your choice.zip / your choice / OS2 / LW22 / JDEBP.CMD < prev    next >
OS/2 REXX Batch file  |  1994-04-20  |  8KB  |  192 lines

  1. /*  ******************************************************************  *\
  2.  *    SysteMCV.CMD --- Yes folks !  This is REXX !                      *
  3.  *                                                                      *
  4.  *    JdeBP's LiveWire script file for connecting to SysteM-C-V and     *
  5.  *    performing a fully automated mail run.  This could probably       *
  6.  *    be adapted to work with any PC Board 15 BBS.                      *
  7.  *                                                                      *
  8.  *    (c) Copyright 1994 Jonathan de Boyne Pollard                      *
  9.  *        Jonathan.de.Boyne.Pollard@p3.f4.n440.z2.fidonet.org           *
  10.  *        JdeBP@donor2.ukmail.net                                       *
  11.  *                                                                      *
  12.  *    Permission is hereby granted to post, steal and abuse this        *
  13.  *    script for your own purposes to your heart's content, as long     *
  14.  *    as you realise that I take no responsibility whatsoever for       *
  15.  *    what it does to your machine, data, cat, or marital status.       *
  16. \*  ******************************************************************  */
  17.  
  18. /* All of these adapted from the learned script */
  19. Trace(Off);
  20. SetLW(TimeOut,60);
  21. SetLW(Pacing,40);
  22. SetLW(Emulation,1);
  23. SetLW(Echo,0);
  24. SetLW(Linefeeds,0);
  25. SetLW(XonXoff,0);
  26. SetLW(BSIsDel,0);
  27.  
  28. /* Here's the main bit folks !                                          */
  29.  
  30.     SendUserName() ;          /* All that logging on stuff is handled   */
  31.     SendLW("Mail^M") ;        /* Enter the mail door from the main menu */
  32.     CamMail() ;               /* My mail door is Cam-Mail               */
  33.     HangUpLW() ;              /* We've said (G)oodbye, so ...           */
  34.  
  35.     exit
  36.  
  37. /*  Wasn't that simple !  That's the power of REXX you know.  (-:       */
  38.  
  39. /*                                                                      */
  40. /*  SendUserName -  This function handles all of the initial logging    */
  41. /*  on nastiness.  The idea of it being a loop is that on noisy lines   */
  42. /*  it should keep reentering your name until either it works, or the   */
  43. /*  BBS hangs up on you in disgust.                                     */
  44. /*                                                                      */
  45.  
  46. SendUserName:
  47.  
  48.     /*  Customise the following for your PC Board setup.                */
  49.  
  50.     /*  The backspaces before my name are to clear up a load of ANSI    */
  51.     /*  junk that somehow gets entered into the username field.         */
  52.  
  53.     /*  Note how we pick the password up from the dialling list entry.  */
  54.  
  55.     Username = "^H^H^H^H^H^H^HJonathan de Boyne Pollard^M"
  56.     Password = GetLW("DialerPassword")||"^M"
  57.     Language = "2"
  58.  
  59.     do forever
  60.  
  61.     /* **************************************************************** *\
  62.      * The following are the modifications needed to login to Channel 1 *
  63.      * in the United State, and are good examples of the modifications  *
  64.      * that may be required in some cases.                              *
  65.      *                                                                  *
  66.      * login=FindLW("anguage # to use",                                 *
  67.      *             ,"graphics (Enter)=no? ",                            *
  68.      *             ,"you want Color? ",                                 *
  69.      *             ,"our first name?",                                  *
  70.      *             ,"Is this correct? ",                                *
  71.      *             ,"rd (Dots will echo)? ",                            *
  72.      *             ,"ead your personal mail",                           *
  73.      *             ," Main Board Command? ");                           *
  74.      *                                                                  *
  75.      * select                                                           *
  76.      * when login="anguage # to use"      then SendLW(Language||"^M") ; *
  77.      * when login="you want Color? "      then SendLW("^M") ;           *
  78.      * when login="graphics (Enter)=no? " then SendLW("^M") ;           *
  79.     \* **************************************************************** */
  80.  
  81.        login=FindLW("used (Enter)=Normal? ",
  82.                    ,"graphics (Enter)=no? ",
  83.                    ,"our first name?",
  84.                    ,"Is this correct? ",
  85.                    ,"rd (Dots will echo)? ",
  86.                    ,"ead your personal mail",
  87.                    ," Main Board Command? ");
  88.  
  89.        select
  90.        when login="used (Enter)=Normal? "  then SendLW(Language||"^M") ;
  91.        when login="graphics (Enter)=no? "  then SendLW("^M") ;
  92.        when login="our first name?"        then SendLW(Username) ;
  93.        when login="Is this correct? "      then SendLW("Y^M") ;
  94.        when login="rd (Dots will echo)? "  then SendLW(Password) ;
  95.        when login="ead your personal mail" then SendLW("N^M") ;
  96.        when login=" Main Board Command? "  then Leave ;
  97.        otherwise do
  98.  
  99.           /*  The only thing that usually will bring you here is   */
  100.           /*  a timeout.  What you do here is up to you.  I just   */
  101.           /*  panic myself.                                        */
  102.  
  103.                  Say "SCRIPT FAILED !!!! The prompt was " login
  104.                  HangUpLW() ;
  105.                  Exit ;
  106.        end
  107.        end
  108.  
  109.     end
  110.  
  111.     /*  We are now at the main board command prompt.                    */
  112.  
  113.     return "" ;
  114.  
  115. /*                                                                      */
  116. /*  CamMail -- A simplistic handler for the Cam-Mail mail door.  This   */
  117. /*  will upload a REP if it exists, then download a QWK and hangup.     */
  118. /*                                                                      */
  119.  
  120. CamMail:
  121.     UploadDir = GetLW("ULDir") ;
  122.     if UploadDir \= "" then UploadDir = UploadDir||"\" ;
  123.     RepFile = UploadDir||"SysteMCV.rep" ;
  124.     Protocol = GetLW("DialerProtocol") ;
  125.  
  126.     /*  These variables track what is going on */
  127.     Uploaded = ( stream(RepFile, 'C', 'Query Exists')="" )
  128.     Downloaded = 0 ;
  129.     Done = 0 ;
  130.  
  131.  
  132.     do until (Done)
  133.  
  134.        cammail=FindLW(" Cam-Mail Command? ",
  135.                      ,"you want to receive these messages",
  136.                      ,"Prepare To Download",
  137.                      ,"(H)angup");
  138.  
  139.        select
  140.        when cammail=" Cam-Mail Command? " then do
  141.  
  142.             select
  143.  
  144.             when \ Uploaded then do
  145.                  SendLW("u^M") ;
  146.                  DelayLW(300) ;
  147.                  SendFilesLW(Protocol, RepFile) ;
  148.                  Uploaded = 1
  149.             end
  150.             when \ Downloaded then do
  151.                  DelayLW(700) ;
  152.                  SendLW("d^M") ;
  153.             end
  154.             otherwise  do
  155.                  SendLW("G^M") ;
  156.                  Done = 1 ;
  157.             end
  158.  
  159.             end
  160.  
  161.        end
  162.        when cammail="you want to receive these messages" then do
  163.             SendLW("Y^M") ;
  164.        end
  165.        when cammail="Prepare To Download" then do
  166.             ReceiveFilesLW(Protocol, "SysteMCV.qwk") ;
  167.             Downloaded = 1 ;
  168.        end
  169.        when cammail="(H)angup" then do
  170.             DelayLW(100) ;
  171.             SendLW("h") ;
  172.             Done = 1 ;
  173.        end
  174.        otherwise nop ;
  175.        end
  176.  
  177.     end
  178.  
  179.     /* This is the fun bit which you can adapt to your own ends.  You   */
  180.     /* now potentially have a QWK in your download directory.  What I   */
  181.     /* do is to start a batch file in the background that copies it to  */
  182.     /* an archive directory, and moves the original into the mail       */
  183.     /* reader's inbound directory.  Of course, TRANSFER.BTM handles all */
  184.     /* of my QWKs, so it takes the BBSID as a parameter.                */
  185.  
  186.     Start "/bg /c Transfer SysteMCV"
  187.  
  188.     /* The transfer now is running in the background.  Good, innit ?    */
  189.  
  190.     return "" ;
  191.  
  192.